<?php
   require_once('system/dbConnect.php');
   require_once('system/MyFunc.php'); 
  connect();
  $id = $_POST['id'];
  if(!empty($_FILES["pic"]["name"]))
    {
  	   $pic = uploadfile('pic','upload/',array('png','jpg','gif'));
    }
  else{
  	$pic=' ';
  }

  $data = array(
   'videoname' => trim($_POST['videoname']),  
		'tid' => $_POST['tid'],
    'pic'=>$pic,
    'intro' => $_POST['intro'],
		'uploaddate' => $_POST['uploaddate'],
    'uploadadmin' => $_POST['uploadadmin'],
    'hittimes' => $_POST['hittimes'],
		'downtimes' => $_POST['downtimes'],
    'address' => $_POST['address']
  	);

  $result = update('videos',$data,'vid='.$id);
  if(!$result){
		echo "更新失败！<br/>";
		echo "<a href='videolist.php'>返回</a>";	  
  }else{		
		redirect('videolist.php', '更新成功！');
  }	   
 ?>